import Vue from 'vue'
import App from './App.vue'
import router from './router'




import { Tabbar, Form,Field,Skeleton , Sticky,TabbarItem,Icon,Tab,Tabs, Grid, GridItem,NavBar,NoticeBar,Tag,Swipe, SwipeItem,Collapse, Sidebar, SidebarItem,Toast, CollapseItem,Search,Card,Cell, CellGroup,Uploader ,Empty, Button,List,ShareSheet  } from 'vant';
import axios from 'axios'
import VueAxios from 'vue-axios'

Vue.use(Tabbar);
Vue.use(TabbarItem);
Vue.use(Tab);
Vue.use(Tag);
Vue.use(Tabs);
Vue.use(Grid);
Vue.use(GridItem);
Vue.use(NavBar);
Vue.use(Swipe);
Vue.use(SwipeItem);
Vue.use(Sticky);
Vue.use(Collapse);
Vue.use(CollapseItem);
Vue.use(Search);
Vue.use(Card);
Vue.use(Cell);
Vue.use(CellGroup);
Vue.use(Uploader);
Vue.use(Button);
Vue.use(NoticeBar);
Vue.use(Empty);
Vue.use(Icon);
Vue.use(List );
Vue.use(Sidebar);
Vue.use(SidebarItem);
Vue.use(Toast);
Vue.use(ShareSheet);
Vue.use(Skeleton );
Vue.use(Form);
Vue.use(Field);


axios.interceptors.request.use(config => {
  Toast.loading({
    message:"加载中...",
    forbidClick:true,
    loadingType:'spinner',
    duration:0,
  })
  return config;
},err =>{
  console.log(err);
  Toast.clear();
  return Promise.reject(err)
})

axios.interceptors.response.use(res =>{
  Toast.clear();
  return res
},err =>{
  console.log(err);
  Toast.clear();
  return Promise.reject(err)
})

Vue.use(VueAxios, axios)
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
